package uk.me.dewi.appenin.android.dao;

import java.util.ArrayList;

import uk.me.dewi.appenin.android.entity.Place;
import uk.me.dewi.net.rest.RestException;
import uk.me.dewi.util.DataAccessException;

import com.google.android.maps.GeoPoint;

public interface PlaceDao {

    /**
     * Create a new place.
     * 
     * @param place to create
     * @return the newly created Place (with id)
     */
    public abstract Place createPlace(Place place) throws DataAccessException;

    /**
     * Delete the place with the given rowId
     * 
     * @param id of place to delete
     * @return true if deleted, false otherwise
     */
    public abstract boolean deletePlace(long id) throws DataAccessException;

    /**
     * Return the places near the current location
     * 
     * @return 
     */
    public abstract ArrayList<Place> getNearbyPlaces(GeoPoint location, int distance) throws DataAccessException;

    public abstract long[] getNearbyPlaceIDs(GeoPoint location, int distance) throws DataAccessException;

    /**
     * Return a place that matches the given id
     * 
     * @param id of place to retrieve
     * @return matching place, if found
     * @throws RestException if place could not be found/retrieved
     */
    public abstract Place fetchPlace(long id) throws DataAccessException;

    /**
     * Update the place using the details provided.
     * 
     * @param place to update
     * @return true if the place was successfully updated, false otherwise
     */
    public abstract boolean updatePlace(Place place) throws DataAccessException;

}